package cn.itsource.basic.config;

import cn.itsource.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// 登陆拦截器配置
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor) // 添加拦截器
            .addPathPatterns("/**")  // 添加拦截的路径
                .excludePathPatterns("/login/account/**") // 路径 接口路径/资源路径
                .excludePathPatterns("/shop/settlement/**")
                .excludePathPatterns("/shop/activity/**")
                .excludePathPatterns("/fastdfs/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/echart/**");
    }
}
